#include "elemento.h"
#include <allegro.h>

void elemento::move() {
	this->x+= vel_x;
	this->y+= vel_y;
}

void elemento::draw(BITMAP *buffer, int fx, int fy, int fw, int fh){}

map<string, bool> elemento::load_stats() {
	char temp_bmp_name[150];
	char temp_att_name[150];
	char temp_default_value[150];
	map<string, bool> temp_stats;
	FILE *pstats = fopen("data/stats.nel", "r");
	
	while (!feof(pstats)) {
		fscanf(pstats," %s", temp_att_name);
		fscanf(pstats," %s", temp_default_value);
		if (!strcmp(temp_default_value, "true"))
			temp_stats[temp_att_name] = true;
		else
			temp_stats[temp_att_name] = false;
	}
	fclose(pstats);

	return temp_stats;
}

map<string, bool> elemento::stats_db = load_stats();

elemento::elemento(int x, int y, int w, int h) {
	this->stats = stats_db;
	this->x = x;
	this->y = y;
	this->w = w;
	this->h = h;
	this->vel_x = 0;
	this->vel_y = 0;
}
